<!DOCTYPE html>
<html>
<head>
    <title></title>
    #parse("sys/header.html")
    <style>
        .table2_1 {
            width:100% ;
        }
        .table2_1 th {
            background-color:#f3f3f3;
            color:#000000
        }
        .table2_1,.table2_1 th,.table2_1 td
        {
            font-size:0.95em;
            text-align:center;
            padding:8px;
            border:1px solid #c1e9fe;
            border-collapse:collapse
        }
        .table2_1 tr:nth-child(odd){
            /*background-color:#dbf2fe;*/
        }
        .table2_1 tr:nth-child(even){
            /*background-color:#fdfdfd;*/
        }
    </style>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <Row :gutter="16">
            <div class="search-group">
                <i-col span="4">
                    <i-input v-model="q.goodsName" @on-enter="query" placeholder="商品名称"/>
                </i-col>
                <i-button @click="query">查询</i-button>
            </div>
            <div class="buttons-group">
                #if($shiro.hasPermission("product:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                #end
                #if($shiro.hasPermission("product:update"))
                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                #end
                #if($shiro.hasPermission("product:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
            </div>
        </Row>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <Card v-if="!showList">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="product" :rules="ruleValidate" :label-width="80">
            <Row>
                <i-col :span="6">
                    <Form-item label="商品" prop="goodsId">
                        <i-select v-model="product.goodsId" filterable @on-change="changeGoods" label-in-value>
                            <i-option v-for="goods in goodss" :value="goods.id" :key="goods.id">{{goods.name}}</i-option>
                        </i-select>
                    </Form-item>
                </i-col>
                <i-col :span="12">
                    <Form-item label="商品序列号" prop="goodsSn">
                        <i-input v-model="product.goodsSn" placeholder="商品序列号" style="width:188px;"/>
                    </Form-item>
                </i-col>
            </Row>

<!--            <Form-item label="商品规格" prop="goodsSpecificationIds">-->
<!--                <Checkbox-group v-model="attribute">-->
<!--                    <Checkbox :label="1">颜色</Checkbox>-->
<!--                    <Checkbox :label="2">规格</Checkbox>-->
<!--                    <Checkbox :label="4">重量</Checkbox>-->
<!--                </Checkbox-group>-->
<!--            </Form-item>-->

<!--            <Form-item label="颜色" v-if="attribute.indexOf(1)>-1" prop="color">-->
<!--                <i-select v-model="color" filterable multiple>-->
<!--                    <i-option v-for="color in colors" :value="color.id" :key="color.id">{{color.value}}</i-option>-->
<!--                </i-select>-->
<!--            </Form-item>-->
<!--            <Form-item label="规格" v-if="attribute.indexOf(2)>-1" prop="guige">-->
<!--                <i-select v-model="guige" filterable multiple>-->
<!--                    <i-option v-for="guige in guiges" :value="guige.id" :key="guige.id">{{guige.value}}</i-option>-->
<!--                </i-select>-->
<!--            </Form-item>-->
<!--            <Form-item label="重量" v-if="attribute.indexOf(4)>-1" prop="weight">-->
<!--                <i-select v-model="weight" filterable multiple>-->
<!--                    <i-option v-for="weight in weights" :value="weight.id" :key="weight.id">{{weight.value}}</i-option>-->
<!--                </i-select>-->
<!--            </Form-item>-->

            <Form-item label="颜色:">
                <Checkbox-group v-model="checkList[0].list" @on-change="checkChange">
                    <Checkbox v-for="item in list[0].list" :value="item.id" :label="item.id">{{item.value}}</Checkbox>
                </Checkbox-group>
            </Form-item>

            <Form-item label="规格:">
                <Checkbox-group v-model="checkList[1].list" @on-change="checkChange">
                    <Checkbox v-for="item in list[1].list" :value="item.id" :label="item.id">{{item.value}}</Checkbox>
                </Checkbox-group>
            </Form-item>

            <Form-item label="重量:">
                <Checkbox-group v-model="checkList[2].list" @on-change="checkChange">
                    <Checkbox v-for="item in list[2].list" :value="item.id" :label="item.id">{{item.value}}</Checkbox>
                </Checkbox-group>
            </Form-item>

            <row>
                <i-col span="24">
                    <table class="table2_1">
                        <thead>
                            <tr>
                                <th v-for="title in addTableTitle">{{title}}</th>
                            </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item, index) in dataList">
                            <td v-for="name in item.valueNameList">{{name}}</td>
                            <td>
                                <i-input v-model="item.goodsNumber" placeholder="商品库存" style="width:188px;"/>
                            </td>
                            <td>
                                <i-input v-model="item.retailPrice" placeholder="零售价格" style="width:188px;"/>
                            </td>
                            <td>
                                <i-input v-model="item.marketPrice" placeholder="市场价格" style="width:188px;"/>
                            </td>
                            <td>
                                <i-input v-model="item.imgUrl" readonly/>
                            </td>
                            <td>
                                <Upload style="width: 100px;" action="../sys/oss/upload" :format="['jpg','jpeg','png']"
                                        max-size="2048"
                                        :on-success="handleSuccessPicUrl"
                                        :show-upload-list="false">
                                    <i-button icon="ios-cloud-upload-outline" @click="changeUploadIndex(index)">上传图片</i-button>
                                </Upload>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </i-col>
            </row>

<!--            <Row>-->
<!--                <i-col span="12">-->
<!--                    <Form-item label="商品库存" prop="goodsNumber">-->
<!--                        <Input-number :min="0" :step="1" v-model="product.goodsNumber" placeholder="商品库存"-->
<!--                                      style="width: 188px;"/>-->
<!--                    </Form-item>-->
<!--                </i-col>-->
<!--            </Row>-->
<!--            <Row>-->
<!--                <i-col span="12">-->
<!--                    <Form-item label="零售价格" prop="retailPrice">-->
<!--                        <Input-number :min="0" :step="1" v-model="product.retailPrice" placeholder="零售价格"-->
<!--                                      style="width: 188px;"/>-->
<!--                    </Form-item>-->
<!--                </i-col>-->
<!--                <i-col span="12">-->
<!--                    <Form-item label="市场价格" prop="marketPrice">-->
<!--                        <Input-number :min="0" :step="1" v-model="product.marketPrice" placeholder="市场价格"-->
<!--                                      style="width: 188px;"/>-->
<!--                    </Form-item>-->
<!--                </i-col>-->
<!--            </Row>-->

            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/>
                返回</i-button>
                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>
</div>

<script src="${rc.contextPath}/js/shop/product.js?_${date.systemTime}"></script>
</body>
</html>